#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
	int t = 1;
	cin >> t;
	while (t--)
	{
		int n;
	    cin >> n;
	    vector<int> a(n + 1);
	    int pos = 0;
	    for (int i = 1; i <= n; i ++ )
	    {
		    cin >> a[i];
		    if (i != 1 && a[i] > a[i - 1] && pos == 0) pos = i - 1;
	    }
	    long double sum1 = 0, sum2 = 0;
	    for (int i = 1; i < pos - 1; i ++ ) sum1 += a[i];
	    for (int i = pos + 2; i <= n; i ++ ) sum2 += a[i];
	    long double ans = a[pos] + a[pos - 1] + a[pos + 1];
	    long double a1=sum1+ans;
	    long double a2=ans+sum2;
	    long double a3=ans+sum1+sum2;
	    if(a1/(pos+1)>=a2/(n-pos+2)&&a1/(pos+1)>=a3/n)
	    {
	    	cout << fixed << setprecision(20) << a1/(pos+1) << endl;
		}
		else if(a2/(n-pos+2)>=a1/(pos+1)&&a2/(n-pos+2)>=a3/n)
	    {
	    	cout << fixed << setprecision(20) << a2/(n-pos+2) << endl;
		}
		else if(a3/n>=a1/(pos+1)&&a3>=a2/(n-pos+2))
	    {
	    	cout << fixed << setprecision(20) << a3/n << endl;
		}
	}
}

